package tests.jdl.databaseObjects;

import org.junit.Before;
import org.junit.Test;

import jdl.databaseObjects.DbObject;
import jdl.databaseObjects.DbObjectState;
import junit.framework.Assert;

public class DbObject_Test {
	private DbObject object;

	@Before
	public void setUp() {
		object = new DbObjectImpl("obj");
	}

	@Test
	public void constructor_checkState() {
		Assert.assertEquals(DbObjectState.NEW, object.getState());
	}

	@Test
	public void toUnchanged_checkState() {
		object.toUnchanged();
		Assert.assertEquals(DbObjectState.UNCHANGED, object.getState());
	}

	@Test
	public void getName() {
		Assert.assertEquals("obj", object.getName());

		object = new DbObjectImpl("hello");
		Assert.assertEquals("hello", object.getName());
	}

	class DbObjectImpl extends DbObject {

		public DbObjectImpl(String name) {
			super(name);
		}
	}
}
